package org.slf4j.impl;

import org.slf4j.ILoggerFactory;
import org.slf4j.Logger;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class LoggerFactory implements ILoggerFactory {
    private Map<String, Logger> loggers;

    public LoggerFactory() {
        loggers = new ConcurrentHashMap<>();
    }

    @Override
    public synchronized Logger getLogger(String s) {
        Logger logger = loggers.get(s);
        if (logger != null) {
            return logger;
        } else {
            logger = new LoggerAdapter(com.db.logger.LoggerFactory.getLogger(s));
            loggers.put(s, logger);
            return logger;
        }
    }
}
